// packageD/newPage/realAuth/realAuth.js
var t = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    username: '',
    cardno: '',
    type: 1,
    orderId: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
      type: options.type,
      orderId: options.orderId
    })
  },
  usernameChange(e) {
    this.setData({
      username: e.detail.value
    })
  },
  cardnoChange(e) {
    this.setData({
      cardno: e.detail.value
    })
  },
  submit() {
    if (this.data.username == '') {
      wx.showToast({
        title: '请输入姓名',
        icon: 'none'
      })
      return;
    }
    if (this.data.cardno == '') {
      wx.showToast({
        title: '请输入身份证号',
        icon: 'none'
      })
      return;
    }
    var that = this;
    var o = t.getNetAddresss("TuWenhua.shiming");
    t._postNetWork({
      url: o,
      data: {
        uid: wx.getStorageSync('yz_uid'),
        name: this.data.username,
        idcard: this.data.cardno,
      },
      success: function (i) {
        var o = i.data;
        if (1 != o.result) return t.tips(o.msg);
        wx.showToast({
          title: '认证成功',
          icon: 'none'
        })
        if (that.data.type == 1) {
          wx.redirectTo({
            url: '/packageG/index/index',
          })
        } else {
          wx.redirectTo({
            url: '/packageD/newPage/uploadAuthorization/uploadAuthorization',
          })
        }

      }
    });
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})